<div class="layui-container">
	<div class="layui-row">
		<div class="layui-col-sm12 layui-col-md12 layui-col-lg12">
			<div class="widget-head">
				<div class="widget-title">
					商品规格
				</div>
			</div>
			<div class="layui-col-md12 layui-col-xs12 widget-body">
				<div class="layui-col-md1">
					<div class="layui-form-item">
						<div class="layui-btn-group">
							<a class="layui-btn " href="{:url('item/saveSpec')}">
							<i class="mdi menu-icon mdi-plus"></i>新增
							</a>
						</div>
					</div>
				</div>
				<form class="layui-form" method="post" action="">
					<input type="hidden" name="s" value="/{$request->pathinfo()}">
					<div class="layui-col-md4 layui-col-flex">
						<label class="layui-form-label">商品分类：</label>
						<span style="display:none;">{$category_id = $request->get('category_id') ?: null}</span>
						<select class="form-control" name="type_id" data-am-selected="{searchBox: 1, btnSize: 'sm'}">
							<option value="0">全部分类</option>
									    {if isset($type)}{foreach ($type as $first)}
							<option {notempty name="$spec.type_id"}{if ($spec.type_id) eq ($first.id)} selected = "selected" {/if}{/notempty}value="{$first['id']}"> {$first['name']}</option>
										{/foreach}{/if}
						</select>
					</div>
					<div class="layui-col-md4">
						<button type="submit" class="layui-btn" lay-submit lay-filter="formDemo">搜索</button>
					</div>
				</form>
				<div class="layui-col-sm12">
					<div class="box-body">
						<div class="row">
							<div class="layui-col-md12">
								<table  class="layui-table">
								<thead>
								<tr>
									<th>
										编号
									</th>
									<th>
										规格类型
									</th>
									<th>
										规格名
									</th>
									<th width="30%">
										规格项
									</th>
									<th>
										排序
									</th>
									<th>
										时间
									</th>
									<th>
										操作
									</th>
								</tr>
								</thead>
								<tbody id="list-table">
						{if !$list->isEmpty()}
						{volist name="list" id="vo"}
								<tr>
									<td class="layer-text-middle">
								{$vo['id']}
									</td>
									<td align="left" class="layer-text-middle">
									{$vo['gettype']['name']}
									</td>
									<td align="left" class="layer-text-middle">
								{$vo['name']}
									</td>
									<td align="left" class="layer-text-middle layer-text-middle-wth">
								{$vo['spec_item']}
									</td>
									<td class="layer-text-middle">
										{$vo['sort_order']}
									</td>
									<td class="layer-text-middle">
										{$vo['create_time']|date="Y-m-d"}
									</td>
									<td class="layer-text-middle">
										<div class="tpl-table-black-operation">
											<a href="{:url('item/saveSpec', ['id' => $vo['id']])}">
											<i class="mdi menu-icon mdi-grease-pencil"></i> 编辑
											</a>
											<a href="javascript:;" class="item-delete tpl-table-black-operation-del" data-id="{$vo['id']}">
											<i class="mdi menu-icon mdi-delete-forever"></i> 删除
											</a>
										</div>
									</td>
								</tr>
						{/volist}
						{else/}
								<tr>
									<td colspan="12" class="layer-text-center">
										暂无记录
									</td>
								</tr>
						{/if}
								</tbody>
								</table>
							</div>
							<div class="layui-fr">{$list|raw}</div>
						</div>
					</div>
				</div>
			</div>
		</div>
	</div>
</div>
<script>
    $(function () {
           // 删除元素
               var url = "<?= url('item/delete') ?>";
        $('.item-delete').delete('id', url,'','Spec');
    });
</script>